package commands;

/**
 * A special type of <code>MeasureCommand</code> that will end the game upon success.
 */
public class EndGameCommand extends Command
{
	public EndGameCommand() {
		this(null);
	}

	public EndGameCommand(String winner) {
		this.winner = winner;
	}

	public net.StateUpdate execute() throws CommandException
	{
		net.StateUpdate stateUpdate = super.execute();
		core.GameParticipantRegistry.get().endGame(winner);
		return stateUpdate;
	}

	public String getWinner() {
		return winner;
	}

	public void setWinner(String winner) {
		this.winner = winner;
	}

	public String toString() {
		return "End the game as a draw";
	}

	private String winner;
}